<template>
    <div id="app">
        <router-view />
    <!-- 底部tabBar -->
    <tabBar v-show="store._state.data.isShow==true" :tabList="tabList" ></tabBar>
    </div>
</template>

<script>
// 引入vuex
import { useStore } from "vuex";
import { useRouter } from "vue-router";
// 引入tabBar组件
import tabBar from "../src/components/tabBar.vue";
// 引入reactive
import { ref, reactive, onMounted } from "vue";
export default {
  // 注册组件
  components: {
    tabBar
  },
  setup(props) {
    const tabList = reactive([
      {
        icon: "wap-home",
        title: "首页",
        href: "/home"
      },
      {
        icon: "label-o",
        title: "分类",
        href: "/cate"
      },
      {
        icon: "shopping-cart-o",
        title: "购物车",
        href: "/cart"
      },
      {
        icon: "friends",
        title: "我的",
        href: "/my"
      }
    ]);
    // 获取vuex
    const store = useStore();
    // 获取router
    const router = useRouter();
    // console.log(store._state.data.active, "vuex");
    const active = ref(store._state.data.active);
    const showTab = ref(store._state.data.isShow); // 控制tabBar是否显示
    return {
      tabList,
      active,
      store,
      router,
      showTab
    };
  }
};
</script>

<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  min-width: 375px;
}

/* 注意这里是全局样式，不用scoped */
@import "@/assets/style/reset.scss"; //引入全局样式重置库
</style>
